<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Inkey</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">Inkey()</font></b></p>
<p><b>语法</b></p><blockquote>

String$ = <font color="#3A3966"><b>Inkey</b></font>()</blockquote>

</blockquote>
<b>概要</b><br><blockquote>

如果调用Inkey()期间按下键返回一个字符串. It doesn't interrupt (halt) the program flow. 如果特殊键（非ASCII）已进行处理， <a href="rawkey.html">RawKey()</a>应在Inkey()之后调用。 

</blockquote><p><b>参数</b></p><blockquote>
无.


</blockquote><p><b>返回值</b></p><blockquote>

返回包含按压字符的字符串，如果它是一个非专用键，以及一个空字符串，否则。 


</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenConsole</font>()
<font color="#3A3966">    PrintN</font>("Press Escape to exit")
  
    <b><font color="#3A3966">Repeat</font></b>
      KeyPressed$ =<font color="#3A3966"> Inkey</font>()
      
      <b><font color="#3A3966">If</font></b> KeyPressed$ &lt;&gt; ""
        
<font color="#3A3966">        PrintN</font>("You pressed: " + KeyPressed$)
<font color="#3A3966">        PrintN</font>("It has a raw code of: "+<font color="#3A3966">Str</font>(<font color="#3A3966">RawKey</font>()))
        
      <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">RawKey</font>()
      
<font color="#3A3966">        PrintN</font>("You pressed a non ASCII key.")
<font color="#3A3966">        PrintN</font>("It has a raw code of: "+<font color="#3A3966">Str</font>(<font color="#3A3966">RawKey</font>()))
        
      <b><font color="#3A3966">Else</font></b>
<font color="#3A3966">        Delay</font>(20) <font color="#3A3966">; Don't eat all the CPU time, we're on a multitask OS</font>
      <b><font color="#3A3966">EndIf</font></b>
    
    <b><font color="#3A3966">Until</font></b> KeyPressed$ =<font color="#3A3966"> Chr</font>(27) <font color="#3A3966">; Wait until escape is pressed</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>备注</b></p><blockquote>

The ASCII codes and numeric values reported in this description may change depending on the code page you have configured at boot time for keyboard input. However, the concepts should be the same and you can use the above example to figure out the real values for your system. <br><br>ASCII码表点<a href="../reference/ascii.html">这里</a>查看。 

</blockquote><p><b>参阅</b></p><blockquote>

<a href="rawkey.html">RawKey()</a>, <a href="input.html">Input()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=enablegraphicalconsole.html>EnableGraphicalConsole()</a> - <a href="index.html">Console Index</a> - <a href="input.html">Input()</a> -&gt;<br><br>

</body></html>